﻿@inject IStringLocalizer<DispatchNormal> Localizer
@inject IDispatchService<BootstrapBlazor.Shared.MessageItem> DispatchService

<Button IsAsync="true" Icon="fa-regular fa-paper-plane" Text="@Localizer["DispatchNoticeButtonText"]" OnClickWithoutRender="OnDispatch" />

@code {
    private async Task OnDispatch()
    {
        DispatchService.Dispatch(new DispatchEntry<BootstrapBlazor.Shared.MessageItem>()
        {
            Name = nameof(BootstrapBlazor.Shared.MessageItem),
            Entry = new BootstrapBlazor.Shared.MessageItem()
            {
                Message = $"{DateTime.Now:HH:mm:ss} {Localizer["DispatchNoticeMessage"]}"
            }
        });
        await Task.Delay(30 * 1000);
    }
}
